package com.kws.merchant.mapper;

import com.kws.merchant.domain.ItemSchemeMerchant;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kws.merchant.domain.OperationPolling;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * 报价-项目商家关联表(ItemSchemeMerchant)表数据库访问层
 *
 * @author yxy
 * @since 2024-11-12 09:45:59
 */

public interface ItemSchemeMerchantMapper extends BaseMapper<ItemSchemeMerchant> {

    @Select("select count(*) from tb_item_scheme_merchant  o left join tb_item_user_scheme s on o.scheme_id=s.scheme_id left join sys_user u on o.user_id=u.user_id where ${sql};")
    int countToTal(@Param("sql") String sql);

    @Select("select o.*,s.scheme_name,u.nick_name,s.deadline_time,m.company_name as merchant_name from tb_item_scheme_merchant  o left join tb_item_user_scheme s on o.scheme_id=s.scheme_id left join sys_user u on o.user_id=u.user_id left join tb_merchant m on m.id=o.merchant_id where ${sql} limit ${sizeNum},${totalPage}; ")
    List<ItemSchemeMerchant> getRecords(@Param("sql") String sql, @Param("sizeNum") int sizeNum, @Param("totalPage") Integer totalPage);


}
